package com.md.facade;

import com.md.api.OpenUsersApi;
import com.md.application.service.OpenUsersApplication;
import com.md.config.Logs;
import com.md.model.system.CommonResult;
import com.md.request.RegisterUsersRequest;
import com.md.request.open.CheckPermissionRequest;
import com.md.request.open.QuerySimpleUsersRequest;
import com.md.request.open.QueryUsersRequest;
import com.md.response.UsersResponse;
import com.md.response.open.SimpleUsersResponse;
import com.md.value.enums.OperationEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘骄阳
 * 2024-07-14 22:16
 */
@RestController
@RequiredArgsConstructor
public class OpenUsersSystemController implements OpenUsersApi {
  private final OpenUsersApplication openUsersApplication;

  @Override
  @Logs(title = "注册用户", operation = OperationEnum.INSERT)
  public CommonResult<UsersResponse> registerUsers(final RegisterUsersRequest request) {
    return openUsersApplication.registerUsers(request);
  }

  @Override
  @Logs(title = "查询用户信息", operation = OperationEnum.SELECT)
  public CommonResult<UsersResponse> queryUserInfo(final QueryUsersRequest request) {
    return openUsersApplication.queryUserInfo(request);
  }

  @Override
  @Logs(title = "校验权限", operation = OperationEnum.SELECT)
  public CommonResult<Boolean> checkPermission(final CheckPermissionRequest request) {
    return openUsersApplication.checkPermission(request);
  }

  @Override
  @Logs(title = "查询用户简易信息", operation = OperationEnum.SELECT)
  public CommonResult<SimpleUsersResponse> simpleInfo(final QuerySimpleUsersRequest request) {
    return openUsersApplication.simpleInfo(request);
  }
}
